<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<head>
    <title>文件下载</title>
    <%@ include file="/WEB-INF/common/header.jsp" %>
</head>
<script type="text/javascript">
    function onblurFn(t_download) {
        if(t_download!=null && t_download !=""){
            //校验用户输入的原密码是否正确
            $.ajax({
                type:"PUT",
                url:"${ctx}/teacher/t-download.action?action=ajaxdownloadFile",
                data:"t_download="+t_download,
                async:false,//同步请求
            });
        }
    }
</script>

<body>
<div class="page-content d-flex align-items-stretch">
    <%@ include file="/WEB-INF/common/navbar.jsp" %>
    <%@ include file="/WEB-INF/common/menu.jsp" %>

    <!-- 内容主体区域 -->
    <div  class="content-inner">

        <!-- 内容主体区域 -->
        <div style="padding: 15px;">
<%--            <form action="" method="get">--%>
<%--                <select name="clazz">--%>
<%--                    <option value="">全体学生</option>--%>
<%--                    <c:forEach items="${clazzes}" var="clazzObject">--%>
<%--                        <c:if test="${clazzObject.id == clazz}">--%>
<%--                            <option value="${clazzObject.id}" selected="selected">${clazzObject.title}</option>--%>
<%--                        </c:if>--%>
<%--                        <c:if test="${clazzObject.id != clazz}">--%>
<%--                            <option value="${clazzObject.id}" >${clazzObject.title}</option>--%>
<%--                        </c:if>--%>
<%--                    </c:forEach>--%>
<%--                </select>--%>
<%--                <input type="submit" value="确定">--%>
<%--            </form>--%>
            <p>======文件信息列表=======</p>
            <table width="100%" border="1px" cellpadding="0" cellspacing="0">
                <thead>
                <tr>
                    <th>序号</th>
                    <th>文件标题</th>
                    <th>文件大小</th>
                    <th>上传时间</th>
                    <th>下载次数</th>
                    <th>文件详情</th>
                    <th>下载文件</th>
                    <th>删除文件</th>
                    <th><a href="${ctx}/teacher/Fileupload">上传文件</a></th>
                </tr>
                </thead>
                <tbody>
                <c:set var="count1" value="1"></c:set>
                <c:forEach items="${files}" var="file">
                    <tr>
                        <td>${count1}</td>
                        <td>${file.fileName}</td>
                        <td>${file.fileSize}</td>
                        <td>${file.uploadTime}</td>
                        <td>${file.downloadCount}</td>
                        <td><a href="${ctx}/teacher/t-details.action?id=${file.id}">详情</a></td>
                        <td id="t_download" name="t_download"><a href="${ctx}/teacher/t-download.action?id=${file.id}" onblur="onblurFn(this.value)">下载</a></td>
                        <td><a href="${ctx}/teacher/t-deleteFile.action?id=${file.id}">删除</a></td>
                    </tr>
                    <c:set var="count1" value="${count1+1}"></c:set>
                </c:forEach>
                </tbody>
            </table>
            <form action="" method="get">
                文件总纪录数${count},共${allPages}页，
                每一页显示<input type="text" name="pageSize" value="${pageSize}">
                跳转到第<input type="text" name="page" value="${page}">页
                <input type="hidden" name="file" value="${file}"><input type="submit" value="确定">

                <a href="${ctx}/teacher/t-showdetailFile?file=${file}&pageSize=${pageSize}&page=1">首页</a>
                <a href="${ctx}/teacher/t-showdetailFile?file=${file}&pageSize=${pageSize}&page=${page-1}">上页</a>
                <a href="${ctx}/teacher/t-showdetailFile?file=${file}&pageSize=${pageSize}&page=${page+1}">下页</a>
                <a href="${ctx}/teacher/t-showdetailFile?file=${file}&pageSize=${pageSize}&page=${allPages}">尾页</a>
            </form>
        </div>
    </div>


</div>

<%@ include file="/WEB-INF/common/footer.jsp"%>
</body>
</html>
